

#include "mvse.h"
#include <iostream>
#include "solid.h"
#include "face.h"
#include "loop.h"
#include "point.h"
#include "vertex.h"
#include "halfedge.h"
#include "edge.h"


MVSE::MVSE(Edge* _edge, int _v, double _x, double _y, double _z )
: edge( _edge )
, v( _v )
, x( _x )
, y( _y )
, z( _z )
{

}




void
MVSE::execute()
{
  std::cout << "\nMVSE::execute() \n";
  HalfEdge* he1 = edge->getHe1();
  HalfEdge* he2 = edge->getHe2();
  Loop* loop = he1->getLoop();
  Face* face = loop->getFace();
  Solid* solid = face->getSolid();
  Edge* newedge = new Edge(solid);
  Point* point = new Point(x,y,z);
  Vertex* newvertex = new Vertex(point,solid);
  newvertex->setVertexno(v);
  newedge->setHe2( he2 );
  he2->setEdg( newedge );
  newedge->addhe(newvertex, he1->getNxt(), PLUS); 
  edge->addhe(newvertex, he2->getNxt(), MINUS);
  newvertex->setVedge( newedge->getHe1() );
}

void
MVSE::unExecute()
{
  std::cout << "\nMVSE::unExecute() NOT IMPLEMENTED!\n";
}







